home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: cs.vu.nl!jalten
- From: jalten@cs.vu.nl (Alten JP)
- Subject: Re: READ THIS!!!!!!!!!!!
- Nntp-Posting-Host: kits.cs.vu.nl
- References: <4em5fs$a86@ixnews4.ix.netcom.com>
- Sender: news@cs.vu.nl
- Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
- Date: Wed, 31 Jan 1996 10:44:53 GMT
- X-Newsreader: TIN [version 1.2 PL2]
- Message-ID: <DM1KIt.3Jx.0.-s@cs.vu.nl>
-
- Jeremy Johnston (jeremyx@ix.netcom.com) wrote:
-
- : ok....now that I have your attention i need some help.
- : I can't get the following command to work & the compiler says that the
- : constant has too many characters.
-
- : char dos;
- : if(dos=='dir')
- : goto b;
-
- My oh my, you have my attention alright, but do I have yours?
- here we go:
- your "dos" variable is just one character, which will mean
- you can't compare it to a string.
- a string (like "dir") should be surrounded by these guys: "
- not by these '
- the latter will surround a character, so your code would work like
- this:
- char dos;
- if (dos=='d')
- goto b;
-
- but, then again, that's probably not what you want. How about:
- char* dos;
- // now do some things, especially assigning dos to a string
- if (strcmp(dos,"dir")==0)
- goto b;
-
- Now, a lot of C++ programmers don't like the use of "goto",
- so try to figure out a different way to do this, it will
- not only help you to eliminate "goto" and make us happy,
- it will also help you thiink about what you really want your
- program to do, and find some stucture in the framework of your
- program.
-
- Any questions, or was it just a way to fool me?
-
- Jelle Paul
-
- PS, how about trying to get a book on C/C++? not to flame you,
- but really, it helps to get accustomed to C/C++
-
-
-
-
- +-------------------------------------------------------+
- | Jelle Paul Alten | jalten@cs.vu.nl |
- | Vrije Universiteit Amsterdam | |
- +-------------------------------------------------------+
-